Improve (debugging) text that announced which xfer protocols are used.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 29 Jan 2006 21:41:06 +0000 (21:41 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 29 Jan 2006 21:41:06 +0000 (21:41 +0000)
Improve several error messages.

gpsbabel/jeeps/garminusb.h
gpsbabel/jeeps/gpsapp.c
gpsbabel/jeeps/gpslibusb.c
gpsbabel/jeeps/gpsserial.c

index 96acc923257d5292c74ef7d26afe8eb329fef504..7e07600dad84052177d0ac044382a5d7d5329aac 100644 (file)
@@ -56,4 +56,4 @@ int gusb_cmd_send(const garmin_usb_packet *obuf, size_t sz);
 int gusb_cmd_get(garmin_usb_packet *ibuf, size_t sz);
 int gusb_open(const char *portname);
 int gusb_close(const char *portname);
-int gusb_init(void);
+int gusb_init(const char *portname);
index 96d2b7af6b457114fbad4ef4a623e8b64f321b26..488ad0f28239776734fda806af4e8b103541c180 100644 (file)
@@ -4,6 +4,7 @@
 ** @author Copyright (C) 1999 Alan Bleasby
 ** @version 1.0 
 ** @modified Dec 28 1999 Alan Bleasby. First version
+** @modified 2004, 2005, 2006 Robert Lipe
 ** @@
 ** 
 ** This library is free software; you can redistribute it and/or
@@ -309,29 +310,20 @@ static void GPS_A001(GPS_PPacket packet)
     
     for(i=0;i<entries;++i,p+=3)
     {
-       char pb[256];
        tag = *p;
        data = GPS_Util_Get_Short(p+1);
 
-       sprintf(pb, "Capability '%c'.  Type %d", tag, data);
-       GPS_User(pb);
-       
+       switch (tag) {
        /* Only one type of P[hysical] so far */
-       if(tag == 'P')
-       {
+       case 'P':
            if(data!=0)
                GPS_Protocol_Error(tag,data);
-           continue;
-       }
-
-       if(tag == 'L')
-       {
+           break;
+       case 'L':
            gps_link_type = data;
-           continue;
-       }
-
-       if(tag == 'A')
-       {
+           break;
+       case 'A':
+           GPS_User("\nCapability %c%d:", tag, data);
            lasta = data;
            if(data<100)
            {
@@ -441,10 +433,10 @@ static void GPS_A001(GPS_PPacket packet)
            {
                GPS_Protocol_Error(tag,data);
            }
-       }
+           break;
 
-       if(tag == 'D')
-       {
+       case 'D':
+           GPS_User(" %c%d", tag, data);
            if(lasta<200)
            {
                if(data<=110 && data>=100)
@@ -532,7 +524,7 @@ static void GPS_A001(GPS_PPacket packet)
 
            else if(lasta<500)
            {
-               if(data<=109 && data>=100)
+               if(data<=110 && data>=100)
                {
                    gps_prx_waypt_type = data;
                    continue;
@@ -614,6 +606,8 @@ static void GPS_A001(GPS_PPacket packet)
        }
     }
 
+    GPS_User("\n");
+
     return;
 }
 
@@ -734,7 +728,7 @@ int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int, GPS_PWay *))
            GPS_D155_Get(&((*way)[i]),rec->data);
            break;
        default:
-           GPS_Error("A100_GET: Unknown waypoint protocol");
+           GPS_Error("A100_GET: Unknown waypoint protocol: %d", gps_waypt_type);
            return PROTOCOL_ERROR;
        }
        /* Issue callback for status updates. */
@@ -750,7 +744,7 @@ int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int, GPS_PWay *))
 
     if(rec->type != LINK_ID[gps_link_type].Pid_Xfer_Cmplt)
     {
-       GPS_Error("A100_GET: Error transferring waypoints");
+       GPS_Error("A100_GET: Error transferring waypoints.  Expected %d completion code.  Got %d", LINK_ID[gps_link_type].Pid_Xfer_Cmplt, rec->type);
        return FRAMING_ERROR;
     }
 
index 7121b6423a37ee76e80251e52742d21210387003..7c568a7a0d15b91e13a14f8177ae79448d042d85 100644 (file)
@@ -53,7 +53,7 @@ static void garmin_usb_scan(void);
 static void garmin_usb_syncup(void);
 
 int
-gusb_init(void)
+gusb_init(const char *portname)
 {
 // usb_set_debug(99);
        usb_init();
index 27b8b6a22de12a1a859ccfff01b5eb3b175f6a5b..ae22dd4312f132b084f7cba294d921c7a4190e47 100644 (file)
@@ -545,7 +545,7 @@ int32 GPS_Serial_Wait(int32 fd)
 int32 GPS_Serial_On(const char *port, int32 *fd)
 {
     if (gps_is_usb) {
-           return gusb_init();
+           return gusb_init(port);
     }
     if(!GPS_Serial_Savetty(port))
     {